<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_content
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;			
global $uid;
$aid = JRequest::getVar('aid');
$sql = "select * from #__gallery where status = 1 and category='products' and user_id =".$uid;
$db	=& JFactory::getDBO();
$db->setQuery($sql);
$rows = $db->loadObjectList();
?>
<h2 class="title">Products</h2>
<p>&nbsp;</p>
<?php 
	if(count($rows)){
	$active = $rows[0];
?>
<div class="left-block">
    <ul class="list-services">
       	<?php 
       		$i=1; 
       		foreach($rows as $item){
				if($item->id == $aid) $active = $item;
		       	$link = JRoute::_('index.php?option=com_content&view=category&id=9&aid='.$item->id);
       	?>
       			<li class="active"><a href="<?php echo $link;?>"><?php echo $i++;?>. <?php echo $item->name;?></a></li>
       	<?php }?>
    </ul>
</div>
<div class="right-block">
    <div class="content">
        <?php 
        if($active->images) echo '<p class="img-content"><img src="images/background/'.$uid.'/products/'.$active->images.'" width="335" /></p>';
        ?>
        <h3><?php echo $active->name;?></h3>
        <?php echo $active->detail;?>
    </div>
</div>
<?php }else{
	echo 'No product.';
}?>